<template>
  <div>
    <el-card>
      <el-row :gutter="10">
        <el-form :inline="true" :model="tableReqForm" class="demo-form-inline">
          <el-form-item label="物品名称">
            <el-input v-model="tableReqForm.productName" placeholder="物品名称"></el-input>
          </el-form-item>
          <el-form-item label="超期天数">
            <el-input v-model="tableReqForm.overdue" placeholder="超期天数"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onSubmit">查询</el-button>
          </el-form-item>
        </el-form>
      </el-row>
      <el-table :data="tableList" border>
        <el-table-column label="No" type="index"></el-table-column>
        <el-table-column label="物品编号" prop="productCode" min-width="200"></el-table-column>
        <el-table-column label="物品名称" prop="productName" min-width="200"></el-table-column>
        <el-table-column label="超期库龄天数" prop="overdue" min-width="200"></el-table-column>
        <el-table-column label="配置库龄天数" prop="initValue" min-width="200"></el-table-column>
        <el-table-column label="存库时间" prop="createTime" min-width="200"  :formatter="this.$utils.dataFormat"></el-table-column>
      </el-table>
      <el-pagination :current-page="1" :page-sizes="[10, 20, 30, 40]" :page-size="10" layout="total, sizes, prev, pager, next, jumper"
        :total="10">
      </el-pagination>
    </el-card>
  </div>
</template>

<script>
  export default {
    name: 'AlarmSearch',
    data() {
      return {
        value: '',
        statusOptions: [{
            value: 'all',
            label: '全部'
          },
          {
            value: 'true',
            label: '开启'
          },
          {
            value: 'false',
            label: '冻结'
          }
        ],
        tableList: [],
        tableReqForm: {
          pageNum: 1,
          pageSize: 10,
          earlyType: 0,
          overdue: '',
          initValue: '',
          createTime: ''
        }
      }
    },
    methods: {
      async getEarlyWarningList() {
        const res = await this.$apiUtil.postByJson('earlyWarning/getEarlyWarningList', this.tableReqForm)
        console.log(res)
        if (res.code !== '200') {
          return this.$message.error(res.msg)
        }
        this.tableList = res.data.earlyWarningVOS
      },
      onSubmit() {
        console.log(this.tableReqForm)
        this.getEarlyWarningList()
      }
    },
    created() {
      this.getEarlyWarningList()
    }
  }
</script>

<style lang="less" scoped>
</style>
